<!DOCTYPE html>
<html style="height: 100%">
<head>
    <meta charset="UTF-8">
    <title>查看路由</title>
    <link rel="shortcut icon" href="/res/img/favicon.ico" type="image/x-icon">
    <link href="/res/layui/css/layui.css" rel="stylesheet">
    <link href="/res/css/common.css" rel="stylesheet">
</head>
<body class="layui-anim layui-anim-downbit" style="height: 100%;padding: 5px">

<#list configs! as config>
    网关监听端口: <b style="color: red;margin-right: 40px">${config.port!'9595'}</b>
    访问URL: <b style="color: red;cursor: pointer" class="port" port="${config.port!'9595'}"></b>
    <table class="layui-table">
        <colgroup>
            <col width="75">
            <col width="75">
            <col width="150">
            <col width="300">
            <col>
        </colgroup>
        <thead>
        <tr>
            <th>类型</th>
            <th>备注</th>
            <th>路由</th>
            <th>目标</th>
        </tr>
        </thead>
        <tbody>
        <#list config.passWs! as pass>
            <tr style="color: #23C343">
                <th>pass</th>
                <th>${pass.type!}</th>
                <th>${pass.source!}</th>
                <th>
                    <#list pass.target! as tar>
                        ${tar}<#if tar_has_next>, </#if>
                    </#list>
                </th>
            </tr>
        </#list>
        <#list config.passHttp! as pass>
            <tr style="color: #4080FF">
                <th>pass</th>
                <th>${pass.type!}</th>
                <th>${pass.source!}</th>
                <th>
                    <#list pass.target! as tar>
                        ${tar}<#if tar_has_next>, </#if>
                    </#list>
                </th>
            </tr>
        </#list>
        <#list config.staticDist! as dist>
            <tr style="color: #F76560">
                <th>dist</th>
                <th>状态: ${dist.enable?string("启用","停用")}<br>
                    模式: ${dist.mode!}<br>
                    索引: ${dist.index!}<br>
                    缓存: ${dist.fileCache!?string}</th>
                <th>${dist.path!}</th>
                <th>${dist.root!}</th>
            </tr>
        </#list>
        </tbody>
    </table>
    <hr style="margin: 15px 0">
</#list>
<script src="/res/js/jquery.min.js"></script>
<script>
    $('.port').click(function () {
        var url=$(this).html()
        window.parent.open(url)
    })
    $('.port').each(function (i, e) {
        var port = $(e).attr('port');
        console.log(port)
        var url = window.location.protocol + '//' + window.location.hostname + ':' + port
        $(e).html(url)
    })
</script>
</body>
</html>